Embodiments of the invention relate generally to computer servers and databases and, more particularly to maintaining web session data that spans multiple servers in a session database.
Because web farms have no “affinity” and each page request can be routed to a different web server, the user cannot keep state on a web server using session variables. Sessions do not span web servers. To do so would require “sticky IP” sessions, or affinity to a particular web server for the user's session. With sticky IP sessions, a user's Internet Protocol (IP) address is mapped internally to an application server instance when the initial request is served by the application server. All subsequent requests coming from the same IP address are redirected by the web server to the application server based upon the mapping stored. If users belonging to the same organization are behind a firewall, to the external world they will appear to have the same IP address. This will result in all users of such an organization being directed to the same application server for all requests made, rather than only one single user being redirected to the same application server. This will slow down response times and reduce the ability of the web farm to provide a load balanced and fault tolerant system. Session variables also incur about 10 KB of memory overhead in addition to the data that is stored in the session.
Methods of storing session state include, but are not limited to, cookies (size limited to 4K), query strings (size limited to 2K) and hidden-form variables (cause HTML bloat). Each of these methods and other alternatives will work with limited data but require the data to travel first to the client and then back to the server.